package com.mistyrain.service.impl;

import com.mistyrain.entity.Account;
import com.mistyrain.entity.Admin;
import com.mistyrain.mapper.AdminMapper;
import com.mistyrain.mapper.UserMapper;
import com.mistyrain.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AdminMapper adminMapper;
    @Autowired
    private UserMapper userMapper;
    @Override
    public Account login(String username, String password,String type) {
        Account account = null;
        switch (type){
            case "user":
                account = userMapper.login(username, password);
                break;
            case "admin":
                account = adminMapper.login(username, password);
                break;
        }
        return account;
    }
}
